import random

"""
猜字游戏：产生一个[1,100]之间的随机整数，然后提示用户猜数字，最多猜5次
"""
x = random.randint(1,100)
print(x)

flag = False
for i in range(1,6):
    guess = int(input('请输入您要猜的数字：'))
    if guess == x:
        print(f'恭喜您，猜对了，您共猜了{i}次，中奖数字为：{x}')
        flag = True
        break
    elif guess > x:
        print('猜大了')
    elif guess < x:
        print('猜小了')

if not flag:
    print('您太衰了，游戏结束！')